﻿<UserControl x:Class="SensorDroneStudio.Views.DroneSelectorView"
             xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid 
        DataContext="{Binding Source={StaticResource Locator}, Path=SelectorViewModel}">
        <Grid.Resources>
            <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></BooleanToVisibilityConverter>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"></ColumnDefinition>
            <ColumnDefinition Width="2*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition Height="60"></RowDefinition>
        </Grid.RowDefinitions>
        <ListBox Margin="5" FontSize="20"
            Grid.ColumnSpan="2"
            ItemsSource="{Binding Path=Drones}" SelectedItem="{Binding Mode=OneWayToSource, Path=Selected}">
            <ListBox.ItemTemplate>
            
                    <DataTemplate>
                    <StackPanel>
                        <TextBlock Text="{Binding Path=Name}"></TextBlock>
                        <TextBlock Text="{Binding Path=Version}"></TextBlock>
                        <TextBlock Text="{Binding Path=Address}"></TextBlock>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <Button  Margin="5" HorizontalAlignment="Left" Width="50" Height="50"
                Style="{DynamicResource MetroCircleButtonStyle}" 
                Command="{Binding Path=Scan}"  
                Grid.Column="0" Grid.Row="1">
            <StackPanel>
            <Rectangle Width="20" Height="20">
                <Rectangle.Fill>
                    <VisualBrush Stretch="Fill" 
                                 Visual="{StaticResource appbar_bluetooth}" />
                </Rectangle.Fill>
            </Rectangle>
                <TextBlock Text="{Binding Path=ScanText}"></TextBlock>
            </StackPanel>
        </Button>
        <controls:MetroProgressBar
            Margin="10,0,0,0"
            EllipseDiameter="30"
            EllipseOffset="0"
            Width="Auto"
            Height="Auto"
            Minimum="0"
            Maximum="0"
            IsIndeterminate="True"
            Grid.Row="1" 
            Grid.Column="0"
            Grid.ColumnSpan="2"
            Foreground="{DynamicResource AccentColorBrush}"
            Value="0"
            Visibility="{Binding Path=Visible}"
            >
            
        </controls:MetroProgressBar>
        
    </Grid>
</UserControl>
